package com.novellotus.iov.carvice.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.novellotus.iov.carvice.R;
import com.novellotus.iov.carvice.bean.FailureBeen;
import com.novellotus.iov.carvice.utils.TimeUtils;

import butterknife.BindView;
import butterknife.OnClick;

public class FailureDetailActivity extends BaseActivity {

    @BindView(R.id.tv_tittle)
    TextView tv_tittle;
    @BindView(R.id.tv_plate_value)
    TextView tv_plate_value;
    @BindView(R.id.tv_linker_value)
    TextView tv_linker_value;
    @BindView(R.id.tv_tel_value)
    TextView tv_tel_value;
    @BindView(R.id.tv_address_value)
    TextView tv_address_value;
    @BindView(R.id.tv_des_value)
    TextView tv_des_value;
    @BindView(R.id.tv_deal_value)
    TextView tv_deal_value;
    @BindView(R.id.tv_statue)
    TextView tv_statue;
    @BindView(R.id.rlt_deal)
    RelativeLayout rlt_deal;
    @BindView(R.id.view_hide)
    View view_hide;
    @BindView(R.id.rlt_deal_time)
    RelativeLayout rlt_deal_time;
    @BindView(R.id.tv_create_time_value)
    TextView tv_create_time_value;
    @BindView(R.id.tv_deal_time_value)
    TextView tv_deal_time_value;

    @Override
    protected void initContentView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_failure_detail);
    }

    @Override
    public void init() {
        tv_tittle.setText("报修详情");
        Bundle bundle = getIntent().getExtras();
        FailureBeen failureBeen = bundle.getParcelable("FailureBeen");
        //0=已取消,1=未处理,2=已处理
        if (failureBeen.getStatus().equals("1")) {
            tv_statue.setText("未处理");
            rlt_deal.setVisibility(View.GONE);
            rlt_deal_time.setVisibility(View.GONE);
            view_hide.setVisibility(View.VISIBLE);
        } else if (failureBeen.getStatus().equals("2")) {
            tv_statue.setText("已处理");

        } else {
            tv_statue.setText("已取消");
        }
        tv_plate_value.setText(failureBeen.getPn());
        tv_linker_value.setText(failureBeen.getLinkman());
        tv_tel_value.setText(failureBeen.getMobile());
        tv_address_value.setText(failureBeen.getAddress());
        tv_des_value.setText(failureBeen.getRemark());
        tv_deal_value.setText(failureBeen.getDealDesc());
        tv_create_time_value.setText(TimeUtils.stampTotime(failureBeen.getReportTime() + ""));
        tv_deal_time_value.setText(TimeUtils.stampTotime(failureBeen.getDealTime() + ""));
    }

    @OnClick(R.id.img_back)
    void back() {
        finish();
    }
}
